{% extends base %}

{% block head %}
<style type="text/css">
    pre {
        margin: 0px;
    }
    input[name=input] {
        overflow: inherit;
    }
</style>
<style type="text/css">
    {% raw css_style %}
</style>
{% end %}

{% block body %}
    {% init error = "" %}
    {% init description = "" %}
    {% init input = "" %}
    {% init output = "" %}

    <div class="plugin-head">
        {% set back_link = "javascript:history.back();" %}
        {% include common/base_title.html %}

        {% if description != "" %}
        <pre class="col-md-12 info">
        {{description}}
        </pre>
        {% end %}

        {% if error != "" %}
        <pre class="col-md-12 error">
        {{error}}
        </pre>
        {% end %}
        {% if rows > 0 %}
        <form method="{{method}}">
            {% if rows == 1 %}
            <input class="col-md-12" name="input" value="{{input}}" placeholder="{{model.placeholder}}"/>
            {% else %}
            <textarea class="col-md-12 code" name="input" rows={{rows}} placeholder="{{model.placeholder}}">{{input}}</textarea>
            {% end %}
            <button>{{model.btn_text}}</button>
        </form>
        {% end %}
    </div>

    {% if html != None and html != "" %}
    <div class="col-md-12 card">{% raw html %}</div>
    {% end %}

    {# 文本输出放到后面 #}
    {% if output != None and output != "" %}
    <pre class="col-md-12 card">{{ output }}</pre>
    {% end %}

    {% if model.show_pagenation %}
    <div class="card">
        {# 分页 #}
        {% set page = model.page %}
        {% set page_max = model.page_max %}
        {% set page_url = model.page_url %}
        {% include mod_pagenation.html %}
    </div>
    {% end %}
{% end %}

{% block aside %}
    {# 选项 #}
    {% if len(model.option_links) > 0 %}
        <div class="aside-item">
            <div class="aside-title">
                选项
            </div>
            <div class="aside-content">
                {% for link in model.option_links %}
                    <li><a class="link" href="{{link.get('url')}}">{{link.get('name')}}</a></li>
                {% end %}
            </div>
        </div>
    {% end %}

    {% raw model.aside_html %}
{% end %}

